/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StartupCompanyManager2012SideProjc.java
 *
 * Created on 05.12.2011, 11:38:03
 */
package startupcompanymanager2012;

import javax.swing.JFrame;

/**
 *
 * @author Matthäus
 */
public class StartupCompanyManager2012SideProjc extends javax.swing.JFrame {

    /** Creates new form StartupCompanyManager2012SideProjc */
    public StartupCompanyManager2012SideProjc() {
        initComponents();
        Core.calendarTimer.stop();
        if (Core.runningSideProject == false && Core.sideProjectFinished == true) {
            newProjects();
        }
        sideProject1RB.setSelected(true);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        sideProjectButtonGroup = new javax.swing.ButtonGroup();
        sideProjectPanel = new javax.swing.JPanel();
        sideProject1RB = new javax.swing.JRadioButton();
        sideProject3RB = new javax.swing.JRadioButton();
        sideProject2RB = new javax.swing.JRadioButton();
        cancelView = new javax.swing.JButton();
        sideProjcStart = new javax.swing.JButton();
        sideProject1RBLabel = new javax.swing.JLabel();
        sideProject2RBLabel = new javax.swing.JLabel();
        sideProject3RBLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N
        setResizable(false);

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(startupcompanymanager2012.StartupCompanyManager2012App.class).getContext().getResourceMap(StartupCompanyManager2012SideProjc.class);
        sideProjectPanel.setBackground(resourceMap.getColor("sideProjectPanel.background")); // NOI18N
        sideProjectPanel.setMinimumSize(new java.awt.Dimension(411, 208));
        sideProjectPanel.setName("sideProjectPanel"); // NOI18N

        sideProject1RB.setBackground(resourceMap.getColor("sideProject1RB.background")); // NOI18N
        sideProjectButtonGroup.add(sideProject1RB);
        sideProject1RB.setText(resourceMap.getString("sideProject1RB.text")); // NOI18N
        sideProject1RB.setName("sideProject1RB"); // NOI18N

        sideProject3RB.setBackground(resourceMap.getColor("sideProject3RB.background")); // NOI18N
        sideProjectButtonGroup.add(sideProject3RB);
        sideProject3RB.setText(resourceMap.getString("sideProject3RB.text")); // NOI18N
        sideProject3RB.setName("sideProject3RB"); // NOI18N

        sideProject2RB.setBackground(resourceMap.getColor("sideProject2RB.background")); // NOI18N
        sideProjectButtonGroup.add(sideProject2RB);
        sideProject2RB.setText(resourceMap.getString("sideProject2RB.text")); // NOI18N
        sideProject2RB.setName("sideProject2RB"); // NOI18N

        cancelView.setBackground(resourceMap.getColor("cancelView.background")); // NOI18N
        cancelView.setText(resourceMap.getString("cancelView.text")); // NOI18N
        cancelView.setName("cancelView"); // NOI18N
        cancelView.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                disposeFrame(evt);
            }
        });

        sideProjcStart.setBackground(resourceMap.getColor("sideProjcStart.background")); // NOI18N
        sideProjcStart.setText(resourceMap.getString("sideProjcStart.text")); // NOI18N
        sideProjcStart.setName("sideProjcStart"); // NOI18N
        sideProjcStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectProject(evt);
            }
        });

        sideProject1RBLabel.setText(resourceMap.getString("sideProject1RBLabel.text")); // NOI18N
        sideProject1RBLabel.setName("sideProject1RBLabel"); // NOI18N

        sideProject2RBLabel.setText(resourceMap.getString("sideProject2RBLabel.text")); // NOI18N
        sideProject2RBLabel.setName("sideProject2RBLabel"); // NOI18N

        sideProject3RBLabel.setText(resourceMap.getString("sideProject3RBLabel.text")); // NOI18N
        sideProject3RBLabel.setName("sideProject3RBLabel"); // NOI18N

        javax.swing.GroupLayout sideProjectPanelLayout = new javax.swing.GroupLayout(sideProjectPanel);
        sideProjectPanel.setLayout(sideProjectPanelLayout);
        sideProjectPanelLayout.setHorizontalGroup(
            sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sideProjectPanelLayout.createSequentialGroup()
                .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(sideProjectPanelLayout.createSequentialGroup()
                        .addGap(113, 113, 113)
                        .addComponent(sideProjcStart)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cancelView))
                    .addGroup(sideProjectPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(sideProject3RB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(sideProject3RBLabel))
                    .addGroup(sideProjectPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, sideProjectPanelLayout.createSequentialGroup()
                                .addComponent(sideProject2RB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(sideProject2RBLabel))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, sideProjectPanelLayout.createSequentialGroup()
                                .addComponent(sideProject1RB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(sideProject1RBLabel)))))
                .addContainerGap(118, Short.MAX_VALUE))
        );
        sideProjectPanelLayout.setVerticalGroup(
            sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, sideProjectPanelLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(sideProject1RBLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sideProject1RB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(26, 26, 26)
                .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(sideProject2RBLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sideProject2RB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(26, 26, 26)
                .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(sideProject3RB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sideProject3RBLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(35, 35, 35)
                .addGroup(sideProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sideProjcStart))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(sideProjectPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(sideProjectPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void selectProject(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectProject

        if (sideProject1RB.isSelected() == true) {
            Core.runningSideProjectNum = 0;
            Core.runningSideProject = true;
            Core.sideProjectFinished = false;
            dispose();
        }
        if (sideProject2RB.isSelected() == true) {
            Core.runningSideProjectNum = 1;
            Core.runningSideProject = true;
            Core.sideProjectFinished = false;
            dispose();
        }
        if (sideProject3RB.isSelected() == true) {
            Core.runningSideProjectNum = 2;
            Core.runningSideProject = true;
            Core.sideProjectFinished = false;
            dispose();
        }
        StartupCompanyManager2012SideProjcWork.buttonWork = true;
        StartupCompanyManager2012SideProjcWork.buttonDebug = false;

        JFrame mainFrame = StartupCompanyManager2012App.getApplication().getMainFrame();
        sideProjcWork = new StartupCompanyManager2012SideProjcWork();
        sideProjcWork.setLocationRelativeTo(mainFrame);
        StartupCompanyManager2012App.getApplication().show(sideProjcWork);


    }//GEN-LAST:event_selectProject

    private void disposeFrame(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disposeFrame
        Core.calendarTimer.start();
        dispose();        
    }//GEN-LAST:event_disposeFrame

    public void newProjects() {
        Core.projc.add(new SideProject());
        StartupCompanyManager2012SideProjc.sideProject1RBLabel.setText(Core.projc.get(0).toString());

        Core.projc.add(new SideProject());
        StartupCompanyManager2012SideProjc.sideProject2RBLabel.setText(Core.projc.get(1).toString());

        Core.projc.add(new SideProject());
        StartupCompanyManager2012SideProjc.sideProject3RBLabel.setText(Core.projc.get(2).toString());

    }

    /**
     * @param args the command line arguments
     */
    public static void init(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(StartupCompanyManager2012SideProjc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(StartupCompanyManager2012SideProjc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(StartupCompanyManager2012SideProjc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(StartupCompanyManager2012SideProjc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new StartupCompanyManager2012SideProjc().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelView;
    private javax.swing.JButton sideProjcStart;
    public static javax.swing.JRadioButton sideProject1RB;
    public static javax.swing.JLabel sideProject1RBLabel;
    public static javax.swing.JRadioButton sideProject2RB;
    public static javax.swing.JLabel sideProject2RBLabel;
    public static javax.swing.JRadioButton sideProject3RB;
    public static javax.swing.JLabel sideProject3RBLabel;
    private javax.swing.ButtonGroup sideProjectButtonGroup;
    private javax.swing.JPanel sideProjectPanel;
    // End of variables declaration//GEN-END:variables
    private JFrame sideProjcWork;
}
